import Mock from 'mockjs'
import '@/mock/extend'



const info = Mock.mock({
  'pageNum':1,
  'total':10,
  'pageSize':10,
  'list|10':[
    {
      'id|+1': 1,
      'tailnumber': '1234',
      'model': 1,
      'airline': '中国东方航空',
      'fleet': '1',
      'deleted': 0,
      'createTime': '2021-06-23 09:12:55',
      'updateTime': '2021-06-23 09:12:56',
      'currentRegistry': 'B@integer(1111,5555)',
      'serialNumber': null,
      'currentFlight': 'AH@integer(555,999)',
      'totalLeg': 2,
      'dep': '北京机场',
      'arr': '海南机场',
      'takeoffTime': '2021-06-23 08:12:56',
      'eta': '2021-06-23 22:12:56',
      'priority': '@integer(1,3)',
      'oooi':'@integer(1,5)',
      'flightLegs': [{
        'id|+1': 1,
        'flightNo': 'HU1388',
        'tailnumber': '1234',
        'depCode3':function(){
          return Mock.Random.pick(['PKX','CAN','A'],1)
        },
        'arrCode3' :function(){
          return Mock.Random.pick(['PKX','CAN','A'],1)
        },
        'depCode4': null,
        'arrCode4': null,
        'dep':function(){
          return Mock.Random.pick(['广州白云','北京大兴','长沙黄花'],1)
        },
        'arr':function(){
          return Mock.Random.pick(['广州白云','北京大兴','长沙黄花'],1)
        },
        'leg': 1,
        'outTime': new Date().toLocaleDateString()+' @integer(2,5):00:44',
        'offTime': new Date().toLocaleDateString()+' @integer(2,7):00:44',
        'onTime': new Date().toLocaleDateString()+' 09:07:52',
        'inTime': new Date().toLocaleDateString()+' @integer(9,14):00:31',
        'eta': new Date().toLocaleDateString()+' 09:15:00',
        'model': '737',
        'fleet': '1',
        'priority': '@integer(1,3)',
        'latestAcarsTime': new Date().toLocaleDateString()+' 10:15:00',
        'efReport': function(){
          return Mock.Random.pick([null,1],1)
        },
        'etopsFlight':'@integer(0,1)',
        'totalLeg': 2,
        'events|1-2': [{
          'id|+1': 1,
          'eventType': 'Fault',
          'name': 'FDE',
          'description': '@title',
          'code': '12314124',
          'flightNo': 'HU1388',
          'leg': 1,
          'ata': 'HU1388第一章',
          'priority': '@integer(1,3)',
          'msgTime': new Date().toLocaleDateString()+' @integer(5,9):00:44',
          'createTime': new Date().toLocaleDateString()+' 09:12:55',
          'tailnumber': '1234',
          'reportId': 0,
          'legId': 1,
          'phase': null,
          'activity': 0,
          'relateId': null,
          'msgType': null,
          'specialFields': null,
          'childrenEvents': [{
            'id|+1': 2,
            'eventType': 'Fault',
            'name': 'MMSG',
            'description': '@title',
            'code': '1245544',
            'flightNo': 'HU1388',
            'leg': 1,
            'ata': 'HU1388第二章',
            'priority': 2,
            'msgTime': new Date().toLocaleDateString()+' 08:21:55',
            'createTime': new Date().toLocaleDateString()+' 08:21:55',
            'tailnumber': '1234',
            'reportId': 0,
            'legId': 1,
            'phase': '飞行阶段',
            'activity': 2,
            'relateId': '1',
            'msgType': 'PLF',
            'specialFields': null
          }]
        }]
      },
      {
        'id|+1': 1,
        'flightNo': 'HU1388',
        'tailnumber': '1234',
        'depCode3':function(){
          return Mock.Random.pick(['PKX','CAN','A'],1)
        },
        'arrCode3' :function(){
          return Mock.Random.pick(['PKX','CAN','A'],1)
        },
        'depCode4': null,
        'arrCode4': null,
        'dep':function(){
          return Mock.Random.pick(['广州白云','北京大兴','长沙黄花'],1)
        },
        'arr':function(){
          return Mock.Random.pick(['广州白云','北京大兴','长沙黄花'],1)
        },
        'leg': 2,
        'outTime': new Date().toLocaleDateString()+' @integer(14,17):10:44',
        'offTime':function(){
          return Mock.Random.pick([new Date().toLocaleDateString()+' 09:00:44',null],1)
        },
        'onTime': function(){
          return Mock.Random.pick([new Date().toLocaleDateString()+' 09:07:52',null],1)
        },
        'inTime':  function(){
          return Mock.Random.pick([new Date().toLocaleDateString()+' '+Mock.Random.integer(20,23)+':20:31',null],1)
        },
        'eta': new Date().toLocaleDateString()+' @integer(20,23):20:31',
        'model': '737',
        'fleet': '1',
        'priority':'@integer(1,3)',
        'latestAcarsTime': new Date().toLocaleDateString()+' 10:15:00',
        'efReport': function(){
          return Mock.Random.pick([null,1],1)
        },
        'etopsFlight': '@integer(0,1)',
        'events|1-2': [{
          'id|+1': 1,
          'eventType': 'Fault',
          'name': 'FDE',
          'description': '@title',
          'code': '12314124',
          'flightNo': 'HU1388',
          'ata': 'HU1388第一章',
          'priority': '@integer(1,3)',
          'msgTime': new Date().toLocaleDateString()+' @integer(17,20):00:44',
          'createTime': new Date().toLocaleDateString()+' 09:12:55',
          'tailnumber': '1234',
          'reportId': 0,
          'legId': 1,
          'phase': null,
          'activity': 0,
          'relateId': null,
          'msgType': null,
          'totalLeg': 2,
          'specialFields': null,
          'childrenEvents': [{
            'id|+1': 2,
            'eventType': 'Fault',
            'name': 'MMSG',
            'description': '3rasdas',
            'code': '1245544',
            'flightNo': 'HU1388',
            'leg': 1,
            'ata': 'HU1388第二章',
            'priority': 2,
            'msgTime': new Date().toLocaleDateString()+' 08:21:55',
            'createTime': new Date().toLocaleDateString()+' 08:21:55',
            'tailnumber': '1234',
            'reportId': 0,
            'legId': 1,
            'phase': '飞行阶段',
            'activity': 2,
            'relateId': '1',
            'msgType': 'PLF',
            'specialFields': null
          }]
        }]
      }
    ]
    }
  ]
 

})


Mock.mock(`${process.env.VUE_APP_API_BASE_URL}/ftmAirplane/monitor/info`, 'post', ({body}) => {
  return {data:info}
})
